#nullable enable

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using PHMEE.Controllers;
using Volo.Abp.Application.Dtos;

namespace PHMEE.EnergyEfficiency;

/// <summary>
/// Ams analog 模拟量
/// </summary>
[Route("api/ams/analog-signal")]
public class AnalogSignalController : PHMEEController, IAnalogSignalAppService
{
    private readonly IAnalogSignalAppService _analogSignalAppService;

    public AnalogSignalController(IAnalogSignalAppService analogSignalAppService)
    {
        _analogSignalAppService = analogSignalAppService;
    }

    /// <summary>
    /// 获取实时模拟量信号
    /// </summary>
    /// <param name="vesselId"></param>
    /// <returns></returns>
    [Route("GetRealtimeAnalogSignals")]
    [HttpGet]
    public Task<List<AnalogGroupDto>> GetRealtimeAnalogSignalsAsync(Guid vesselId)
    {
        return _analogSignalAppService.GetRealtimeAnalogSignalsAsync(vesselId);
    }

    /// <summary>
    /// 查询模拟量信号
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="tagName"></param>
    /// <param name="tagDescription"></param>
    /// <param name="startDateTime"></param>
    /// <param name="endDateTime"></param>
    /// <param name="skipCount"></param>
    /// <param name="maxResultCount"></param>
    /// <returns></returns>
    [Route("GetAnalogSignals")]
    [HttpGet]
    public Task<PagedResultDto<AnalogSignalDto>> GetAnalogSignalsAsync(Guid vesselId, string? tagName,
        string? tagDescription, [Required] DateTime startDateTime, [Required] DateTime endDateTime, int skipCount, int maxResultCount)
    {
        return _analogSignalAppService.GetAnalogSignalsAsync(vesselId, tagName, tagDescription, startDateTime, endDateTime, skipCount, maxResultCount);
    }

    // /// <summary>
    // /// 根据 tagNames 查询每个 tag 最新的一条数据，若不传 tagNames，则查询所有 tag 的最新数据
    // /// </summary>
    // /// <param name="vesselId"></param>
    // /// <param name="tagNames"></param>
    // /// <returns></returns>
    // [Route("GetAnalogSignalsByTagnames")]
    // [HttpGet]
    // public Task<List<AnalogSignalDto>> GetAnalogSignalsByTagnamesAsync(Guid vesselId, List<string> tagNames)
    // {
    //     return _analogSignalAppService.GetAnalogSignalsByTagnamesAsync(vesselId, tagNames);
    // }
}